<?
require '../inc.php';
////////////////////
$act  = isset($_GET['act'])?$_GET['act']:'main';
$page = isset($_GET['page'])?(int)$_GET['page']:1;
$rows = isset($_GET['rows'])?(int)$_GET['rows']:2;

$c1id = isset($_GET['c1id'])?(int)$_GET['c1id']:0;
$c2id = isset($_GET['c2id'])?(int)$_GET['c2id']:0;
$c3id = isset($_GET['c3id'])?(int)$_GET['c3id']:0;
$c4id = isset($_GET['c4id'])?(int)$_GET['c4id']:0;

$q     = $_GET["q"];
$order = $_GET["order"];

$gLocation = isset($_GET['gLocation'])?(int)$_GET['gLocation']:0;
$good      = $_GET["good"];
$style 	   = $_GET["style"];

tpl::assign('act',$act);
tpl::assign('page',$page);
tpl::assign('rows',$rows);
tpl::assign('c1id',$c1id);
tpl::assign('c2id',$c2id);
tpl::assign('c3id',$c3id);
tpl::assign('c4id',$c4id);
tpl::assign('q',$q);
tpl::assign('order',$order);
tpl::assign('gLocation',$gLocation);
tpl::assign('good',$good);
tpl::assign('style',$style);
$db_goods  = &new db($scfg['db']['goods']);
$catIdArr  = array("c1id" =>$c1id,"c2id" =>$c2id,"c3id" =>$c3id,"c4id" =>$c4id);
$catNameArr= cat::id2name($db_goods,$catIdArr);
tpl::assign('catIdArr',$catIdArr);	
tpl::assign('catNameArr',$catNameArr);
//输出
$rs = search::cats($db_goods,$c1id,$c2id,$c3id,$c4id,
							$page,$rows,
							$good,
							$q,
							$order,
							$gLocation);
$db_member 	= new db($scfg['db']['member']);
$time       = time();
foreach($rs["rs"] as $k=>&$v)
{
	$v["area"] = pct::area($db_member,$v); 
	$v["time"] = pct::time($v["dwValidDurationExt"]-$time);
	$v["postage"] = pct::cTransportType($v);
}
tpl::assign('rs',$rs);
tpl::display("search/index.search.tpl.php");
?>